package com.hz.userservice.controller;

import com.hz.apiservice.model.dto.StudentDTO;
import com.hz.apiservice.model.request.ApiResponse;
import com.hz.userservice.service.StudentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class StudentController {
    @Resource
    StudentService studentService;

    @GetMapping("/student-info")
    public String studentInfo(@RequestParam("studentId") Integer studentId){
        StudentDTO studentDTO=studentService.getStudentById(studentId);
        return studentDTO==null? ApiResponse.resNotFound():ApiResponse.ok(studentDTO);
    }
}
